package com.kooison.idevice4u.bean;

import java.util.ArrayList;

public class DocContent {
	
	public static String CreateContent(String path, int count, String product) {
		StringBuffer html = new StringBuffer();
		html.append("<html>");
		html.append("<body>");
		html.append("Monitoring link = [<a href=\"" + path + "\">" + path + "</a>]");
		html.append("<br>");
		// html.append("Count = " + count);
		// html.append("<br>");
		if (count > 1) {
			html.append("<font color=\"red\"><b>" + product + " is available now!!!</b></font>");
		} else {
			html.append(product + " is not available yet... :(");
		}
		html.append("</body>");
		html.append("</html>");
		
		return html.toString();
	}
	
	public static String CreateTitle(int count, String product) {
		if (count > 1) {
			return product + " is available now!!!";
		} else {
			return product + " is not available yet... :(";
		}
	
	}
	
	public static String CreateTitle(ArrayList<ProductDetail> list) {
		String product = null;
		for (ProductDetail bean : list) {
			product = bean.getProductName();
			if (bean.isAvailable()) {
				return bean.getProductName() + " is available now!!!";
			}
		}
		return product + " is not available yet... :(";
	}
	
	public static String CreateContent(ArrayList<ProductDetail> list) {
		StringBuffer html = new StringBuffer();
		html.append("<html>");
		html.append("<body>");
		for (ProductDetail bean : list) {
			String path = bean.getUrl();
			html.append("Monitoring link = [<a href=\"" + path + "\">" + path + "</a>]");
			html.append("<br>");
			if (bean.isAvailable()) {
				html.append("<font color=\"red\"><b>" + bean.getProductName() + " is available now!!!</b></font>");
			} else {
				html.append(bean.getProductName() + " is not available yet... :(");
			}
			html.append("<br>");
			html.append("<br>");
		}
		html.append("</body>");
		html.append("</html>");
		return html.toString();
	}
}
